home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_12_08 / pugh / pugh01.lst < prev   
Encoding:
File List  |  1994-06-12  |  798 b   |  68 lines

  1. Listing 1 - Objective-C
  2.  
  3. /* Entry Object */
  4.  
  5. #import <Object.h>
  6.  
  7. @interface Entry : Object
  8. {
  9.   double amount;
  10.   id acct;
  11. }
  12.  
  13. + new;
  14.  
  15.  
  16. -setAmount:(double)theAmt;
  17. -(double)getAmount;
  18. -postEntry;
  19.  .
  20.  .
  21. @end
  22.  
  23. /* Entry Object */
  24.  
  25. #import <Entry.h>
  26.  
  27. @implementation Entry
  28.  
  29. + new
  30. {
  31.    [super new];
  32. }
  33. -init;
  34. {
  35.   acct = [Account new];
  36. }
  37. -setAmount:(double)theAmt
  38. {
  39.    amount = theAmt;
  40. }
  41. -(double)getAmount
  42. {
  43.    return amount;
  44. }
  45. -postEntry
  46. {
  47.   [acct debitBalance:amount];  //subtract
  48. }
  49.  .
  50. @end
  51.  
  52. /* main */
  53.  
  54. #import <Entry.h>
  55.  
  56. main(void)
  57. {
  58.   id Check;
  59.  
  60.   Check = [Entry new];
  61.   [Check setAmount: 12.56];
  62.   [Check setPayee: "MediaScape"];
  63.   [Check postEntry]; // [Account postEntry: check];
  64.   .
  65.   [Check storeOn: "Entry.io"];
  66.  
  67. }
  68.